package com.nami.message.acl.repository.phismsgs.convertor;

import com.nami.message.domain.model.pmsg.PChatMsgModel;
import com.nami.message.core.mybatis.dataobject.PrivateHisMsgsDO;

import java.util.Date;

public class Model2PrivateHisMsgsDOConvertor {

    public static PrivateHisMsgsDO toDO(final PChatMsgModel model) {
        PrivateHisMsgsDO hisMsgs = new PrivateHisMsgsDO();
        hisMsgs.setMsgId(model.getMessageId());
        hisMsgs.setSenderId(model.getSenderId());
        hisMsgs.setReceiverId(model.getReceiverId());
        hisMsgs.setAppKey(model.getAppKey());
        hisMsgs.setPayload(model.getPayload());
        hisMsgs.setPayloadType(model.getPayloadType());
        hisMsgs.setSendTime(model.getSendTime());
        hisMsgs.setConverId(model.getCid());
        hisMsgs.setClientMsgId(model.getClientMsgId());
        hisMsgs.setSeq(model.getSeq());
        hisMsgs.setConverType(1); // c2c
        hisMsgs.setIfRead(Boolean.FALSE);
        hisMsgs.setCreateTime(new Date());

        return hisMsgs;
    }


}
